<template>
	<div class="bigDiv">
		<el-form :inline="true" label-width="100px">
			<div class="topNav">
				<el-button type="text" icon="el-icon-search" @click="getList" style="float:right;">搜索</el-button>
				<el-button type="text" icon="el-icon-refresh" @click="reset"
					style="float:right;margin-right:10px;">重置</el-button>
				<el-button type="text" icon="el-icon-plus" @click="editProduct">新增巡查</el-button>
				<!-- <el-button type="text" @click="exportIt">导出</el-button> -->
			</div>
			<el-form-item label="巡查单编号" prop="seq_no">
				<el-input v-model="queryParams.seq_no" placeholder="请输入巡查单编号" clearable size="small"
					@keyup.enter.native="getList" />
			</el-form-item>
			<el-form-item label="小区编码" prop="block">
				<el-input v-model="queryParams.block" placeholder="请输入小区编码" clearable size="small"
					@keyup.enter.native="getList" />
			</el-form-item>
		</el-form>
		<el-table v-loading="loading" :data="list" border height="calc(100vh - 320px)">
			<!-- <el-table-column label="id" align="center" prop="id" fixed="left"></el-table-column> -->
			<el-table-column label="巡检单编号" align="center" prop="seqNo"></el-table-column>
			<el-table-column label="检查点1" align="center" prop="desPoint01"></el-table-column>
			<el-table-column label="检查点2" align="center" prop="desPoint02"></el-table-column>
			<el-table-column label="检查点3" align="center" prop="desPoint03"></el-table-column>
			<el-table-column label="检查点4" align="center" prop="desPoint04"></el-table-column>
			<el-table-column label="检查点5" align="center" prop="desPoint05"></el-table-column>
			<el-table-column label="检查点6" align="center" prop="desPoint06"></el-table-column>
			<el-table-column label="检查点7" align="center" prop="desPoint07"></el-table-column>
			<el-table-column label="检查点8" align="center" prop="desPoint08"></el-table-column>
			<el-table-column label="检查点9" align="center" prop="desPoint09"></el-table-column>
			<el-table-column label="检查点10" align="center" prop="desPoint10"></el-table-column>
			<el-table-column label="检查点11" align="center" prop="desPoint11"></el-table-column>
			<el-table-column label="检查点12" align="center" prop="desPoint12"></el-table-column>
			<el-table-column label="检查点13" align="center" prop="desPoint13"></el-table-column>
			<el-table-column label="操作" align="center" width="200" fixed="right">
				<template slot-scope="scope">
					<div class="centered-content">
						<el-button type="text" size="mini" class="editBtn" @click="editProduct(scope.row)">
							编辑
						</el-button>
						<el-button type="text" size="mini" class="deleteBtn" @click="delProduct(scope.row)">
							删除
						</el-button>
					</div>
				</template>
			</el-table-column>
		</el-table>
		<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
			:limit.sync="queryParams.pageSize" @pagination="getList" />
		<!-- 弹窗 -->
		<el-dialog title="新增巡查" :visible.sync="visible" :close-on-click-modal="false" :close-on-press-escape="false"
			width="40%">
			<el-form ref="form" :model="dataForm" :rules="rules" label-width="90px">
				<!-- <el-row :gutter="20">
					<el-col :span="12">
						<el-form-item label="创建者" prop="createBy">
							<el-input v-model="dataForm.createBy" placeholder="请输入创建者" clearable
								:style="{ width: '100%' }" :maxlength="10"
								@input="/^\d+(.\d{1,2})?$/.test(dataForm.createBy)"></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="小区编号" prop="useSquare">
							<el-input v-model="dataForm.block" placeholder="小区编号" clearable :style="{ width: '100%' }"
								:maxlength="10" @input="/^\d+(.\d{1,2})?$/.test(dataForm.block)"></el-input>
						</el-form-item>
					</el-col>
				</el-row> -->
				<el-row :gutter="20">
					<el-col :span="24">
						<el-form-item label="巡检单编号" prop="seqNo">
							<el-input v-model="dataForm.seqNo" placeholder="请输入巡检单编号" clearable disabled
								:style="{ width: '100%' }" :maxlength="10"
								@input="/^\d+(.\d{1,2})?$/.test(dataForm.seqNo)"></el-input>
						</el-form-item>
					</el-col>

				</el-row>

				<el-row :gutter="20">
					<el-col :span="12">
						<el-form-item label="检查点1" prop="desPoint01">
							<el-input v-model="dataForm.desPoint01" placeholder="请输入检查点1巡检结果" clearable
								:style="{ width: '100%' }" :maxlength="10"
								@input="/^\d+(.\d{1,2})?$/.test(dataForm.desPoint01)"></el-input>
							<el-upload class="upload-demo" :action="fileUrl" :on-preview="handlePreview"
								:on-remove="(response, file, fileList) => handleRemove(response, file, fileList, 'desPoint01')" :before-remove="beforeRemove"
								:on-success="(response, file, fileList) => handleAvatarSuccess(response, file, fileList, 'desPoint01')"
								:on-change="onChange" multiple :limit="5" :on-exceed="handleExceed"
								:file-list="dataForm.imgPoint01" list-type="picture" :preview-src-list="dataForm.imgPoint01">
								<el-button size="small" type="primary">点击上传</el-button>
							</el-upload>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="检查点2" prop="desPoint02">
							<el-input v-model="dataForm.desPoint02" placeholder="请输入检查点2巡检结果" clearable
								:style="{ width: '100%' }" :maxlength="10"
								@input="/^\d+(.\d{1,2})?$/.test(dataForm.desPoint02)"></el-input>
							<el-upload class="upload-demo" :action="fileUrl" :on-preview="handlePreview"
								:on-remove="(response, file, fileList) => handleRemove(response, file, fileList, 'desPoint02')" :before-remove="beforeRemove"
								:on-success="(response, file, fileList) => handleAvatarSuccess(response, file, fileList, 'desPoint02')"
								:on-change="onChange" multiple :limit="5" :on-exceed="handleExceed"
								:file-list="dataForm.imgPoint02" list-type="picture" :preview-src-list="dataForm.imgPoint02">
								<el-button size="small" type="primary">点击上传</el-button>
							</el-upload>
						</el-form-item>
					</el-col>

				</el-row>
				<el-row :gutter="20">
					<el-col :span="12">
						<el-form-item label="检查点3" prop="desPoint03">
							<el-input v-model="dataForm.desPoint03" placeholder="请输入检查点3巡检结果" clearable
								:style="{ width: '100%' }" :maxlength="10"
								@input="/^\d+(.\d{1,2})?$/.test(dataForm.desPoint03)"></el-input>
							<el-upload class="upload-demo" :action="fileUrl" :on-preview="handlePreview"
								:on-remove="(response, file, fileList) => handleRemove(response, file, fileList, 'desPoint03')" :before-remove="beforeRemove"
								:on-success="(response, file, fileList) => handleAvatarSuccess(response, file, fileList, 'desPoint03')"
								:on-change="onChange" multiple :limit="5" :on-exceed="handleExceed"
								:file-list="dataForm.imgPoint03" list-type="picture" :preview-src-list="dataForm.imgPoint03">
								<el-button size="small" type="primary">点击上传</el-button>
							</el-upload>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="检查点4" prop="desPoint04">
							<el-input v-model="dataForm.desPoint04" placeholder="请输入检查点4巡检结果" clearable
								:style="{ width: '100%' }" :maxlength="10"
								@input="/^\d+(.\d{1,2})?$/.test(dataForm.desPoint04)"></el-input>
							<el-upload class="upload-demo" :action="fileUrl" :on-preview="handlePreview"
								:on-remove="(response, file, fileList) => handleRemove(response, file, fileList, 'desPoint04')" :before-remove="beforeRemove"
								:on-success="(response, file, fileList) => handleAvatarSuccess(response, file, fileList, 'desPoint04')"
								:on-change="onChange" multiple :limit="5" :on-exceed="handleExceed"
								:file-list="dataForm.imgPoint04" list-type="picture" :preview-src-list="dataForm.imgPoint04">
								<el-button size="small" type="primary">点击上传</el-button>
							</el-upload>
						</el-form-item>
					</el-col>

				</el-row>
				<el-row :gutter="20">
					<el-col :span="12">
						<el-form-item label="检查点5" prop="desPoint05">
							<el-input v-model="dataForm.desPoint05" placeholder="请输入检查点5巡检结果" clearable
								:style="{ width: '100%' }" :maxlength="10"
								@input="/^\d+(.\d{1,2})?$/.test(dataForm.desPoint05)"></el-input>
							<el-upload class="upload-demo" :action="fileUrl" :on-preview="handlePreview"
								:on-remove="(response, file, fileList) => handleRemove(response, file, fileList, 'desPoint05')" :before-remove="beforeRemove"
								:on-success="(response, file, fileList) => handleAvatarSuccess(response, file, fileList, 'desPoint05')"
								:on-change="onChange" multiple :limit="5" :on-exceed="handleExceed"
								:file-list="dataForm.imgPoint05" list-type="picture" :preview-src-list="dataForm.imgPoint05">
								<el-button size="small" type="primary">点击上传</el-button>
							</el-upload>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="检查点6" prop="desPoint06">
							<el-input v-model="dataForm.desPoint06" placeholder="请输入检查点6巡检结果" clearable
								:style="{ width: '100%' }" :maxlength="10"
								@input="/^\d+(.\d{1,2})?$/.test(dataForm.desPoint06)"></el-input>
							<el-upload class="upload-demo" :action="fileUrl" :on-preview="handlePreview"
								:on-remove="(response, file, fileList) => handleRemove(response, file, fileList, 'desPoint06')" :before-remove="beforeRemove"
								:on-success="(response, file, fileList) => handleAvatarSuccess(response, file, fileList, 'desPoint06')"
								:on-change="onChange" multiple :limit="5" :on-exceed="handleExceed"
								:file-list="dataForm.imgPoint06" list-type="picture" :preview-src-list="dataForm.imgPoint06">
								<el-button size="small" type="primary">点击上传</el-button>
							</el-upload>
						</el-form-item>
					</el-col>

				</el-row>
				<el-row :gutter="20">
					<el-col :span="12">
						<el-form-item label="检查点7" prop="desPoint07">
							<el-input v-model="dataForm.desPoint07" placeholder="请输入检查点7巡检结果" clearable
								:style="{ width: '100%' }" :maxlength="10"
								@input="/^\d+(.\d{1,2})?$/.test(dataForm.desPoint07)"></el-input>
							<el-upload class="upload-demo" :action="fileUrl" :on-preview="handlePreview"
								:on-remove="(response, file, fileList) => handleRemove(response, file, fileList, 'desPoint07')" :before-remove="beforeRemove"
								:on-success="(response, file, fileList) => handleAvatarSuccess(response, file, fileList, 'desPoint07')"
								:on-change="onChange" multiple :limit="5" :on-exceed="handleExceed"
								:file-list="dataForm.imgPoint07" list-type="picture" :preview-src-list="dataForm.imgPoint07">
								<el-button size="small" type="primary">点击上传</el-button>
							</el-upload>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="检查点8" prop="desPoint08">
							<el-input v-model="dataForm.desPoint08" placeholder="请输入检查点8巡检结果" clearable
								:style="{ width: '100%' }" :maxlength="10"
								@input="/^\d+(.\d{1,2})?$/.test(dataForm.desPoint08)"></el-input>
							<el-upload class="upload-demo" :action="fileUrl" :on-preview="handlePreview"
								:on-remove="(response, file, fileList) => handleRemove(response, file, fileList, 'desPoint08')" :before-remove="beforeRemove"
								:on-success="(response, file, fileList) => handleAvatarSuccess(response, file, fileList, 'desPoint08')"
								:on-change="onChange" multiple :limit="5" :on-exceed="handleExceed"
								:file-list="dataForm.imgPoint08" list-type="picture" :preview-src-list="dataForm.imgPoint08">
								<el-button size="small" type="primary">点击上传</el-button>
							</el-upload>
						</el-form-item>
					</el-col>

				</el-row>
				<el-row :gutter="20">
					<el-col :span="12">
						<el-form-item label="检查点9" prop="desPoint09">
							<el-input v-model="dataForm.desPoint09" placeholder="请输入检查点9巡检结果" clearable
								:style="{ width: '100%' }" :maxlength="10"
								@input="/^\d+(.\d{1,2})?$/.test(dataForm.desPoint09)"></el-input>
							<el-upload class="upload-demo" :action="fileUrl" :on-preview="handlePreview"
								:on-remove="(response, file, fileList) => handleRemove(response, file, fileList, 'desPoint09')" :before-remove="beforeRemove"
								:on-success="(response, file, fileList) => handleAvatarSuccess(response, file, fileList, 'desPoint09')"
								:on-change="onChange" multiple :limit="5" :on-exceed="handleExceed"
								:file-list="dataForm.imgPoint09" list-type="picture" :preview-src-list="dataForm.imgPoint09">
								<el-button size="small" type="primary">点击上传</el-button>
							</el-upload>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="检查点10" prop="desPoint10">
							<el-input v-model="dataForm.desPoint10" placeholder="请输入检查点10巡检结果" clearable
								:style="{ width: '100%' }" :maxlength="10"
								@input="/^\d+(.\d{1,2})?$/.test(dataForm.desPoint10)"></el-input>
							<el-upload class="upload-demo" :action="fileUrl" :on-preview="handlePreview"
								:on-remove="(response, file, fileList) => handleRemove(response, file, fileList, 'desPoint10')" :before-remove="beforeRemove"
								:on-success="(response, file, fileList) => handleAvatarSuccess(response, file, fileList, 'desPoint10')"
								:on-change="onChange" multiple :limit="5" :on-exceed="handleExceed"
								:file-list="dataForm.imgPoint10" list-type="picture" :preview-src-list="dataForm.imgPoint10">
								<el-button size="small" type="primary">点击上传</el-button>
							</el-upload>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row :gutter="20">
					<el-col :span="12">
						<el-form-item label="检查点11" prop="desPoint11">
							<el-input v-model="dataForm.desPoint11" placeholder="请输入检查点11巡检结果" clearable
								:style="{ width: '100%' }" :maxlength="10"
								@input="/^\d+(.\d{1,2})?$/.test(dataForm.desPoint11)"></el-input>
							<el-upload class="upload-demo" :action="fileUrl" :on-preview="handlePreview"
								:on-remove="(response, file, fileList) => handleRemove(response, file, fileList, 'desPoint11')" :before-remove="beforeRemove"
								:on-success="(response, file, fileList) => handleAvatarSuccess(response, file, fileList, 'desPoint11')"
								:on-change="onChange" multiple :limit="5" :on-exceed="handleExceed"
								:file-list="dataForm.imgPoint11" list-type="picture" :preview-src-list="dataForm.imgPoint11">
								<el-button size="small" type="primary">点击上传</el-button>
							</el-upload>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="检查点12" prop="desPoint12">
							<el-input v-model="dataForm.desPoint12" placeholder="请输入检查点12巡检结果" clearable
								:style="{ width: '100%' }" :maxlength="10"
								@input="/^\d+(.\d{1,2})?$/.test(dataForm.desPoint12)"></el-input>
							<el-upload class="upload-demo" :action="fileUrl" :on-preview="handlePreview"
								:on-remove="(response, file, fileList) => handleRemove(response, file, fileList, 'imgPoint12')" :before-remove="beforeRemove"
								:on-success="(response, file, fileList) => handleAvatarSuccess(response, file, fileList, 'imgPoint12')"
								:on-change="onChange" multiple :limit="5" :on-exceed="handleExceed"
								:file-list="dataForm.imgPoint12" list-type="picture" :preview-src-list="dataForm.imgPoint12">
								<el-button size="small" type="primary">点击上传</el-button>
							</el-upload>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row :gutter="20">
					<el-col :span="12">
						<el-form-item label="检查点13" prop="desPoint13">
							<el-input v-model="dataForm.desPoint13" placeholder="请输入检查点13巡检结果" clearable
								:style="{ width: '100%' }" :maxlength="10"
								@input="/^\d+(.\d{1,2})?$/.test(dataForm.desPoint13)"></el-input>
							<el-upload class="upload-demo" :action="fileUrl" :on-preview="handlePreview"
								:on-remove="(response, file, fileList) => handleRemove(response, file, fileList, 'imgPoint13')" :before-remove="beforeRemove"
								:on-success="(response, file, fileList) => handleAvatarSuccess(response, file, fileList, 'imgPoint13')"
								:on-change="onChange" multiple :limit="5" :on-exceed="handleExceed"
								:file-list="dataForm.imgPoint13" list-type="picture" :preview-src-list="dataForm.imgPoint13">
								<el-button size="small" type="primary">点击上传</el-button>
							</el-upload>
						</el-form-item>
					</el-col>
				</el-row>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button @click="visible = false">取 消</el-button>
				<el-button type="primary" @click="submitProduct()">确 定</el-button>
			</span>
		</el-dialog>
	</div>
</template>

<script>
	import {
		flowInspectionGuard,
		insertFlowInspectionGuard,
		editFlowInspectionGuard,
		deleteFlowInspectionGuard
	} from '@/api/wuye.js'
	// 上传文件
	import fileUpdata from '@/api/file.config'
	export default {
		name: "product",
		// 页面数据
		data() {
			return {
				queryParams: {
					pageNum: 1, // 显示第一页数据
					pageSize: 10, //每页显示十条
				},
				dataForm: {
					id: "",
					block: "",
					seqNo: "",
					desFitnessFacilities: "",
					desRainwaterWells: "",
					desWaterTank: "",
					desSubstation: "",
					desPublicLighting: "",
					desPavement: "",
					desPublicAreas: "",
					desBuildingDoors: "",
					desPumpRoom: "",
					desPlayground: "",
					createBy: "",
					createTime: "",
					updateBy: "",
					updateTime: "",
					remark: "",
					imgPoint01: [],
					imgPoint02: [],
					imgPoint03: [],
					imgPoint04: [],
					imgPoint05: [],
					imgPoint06: [],
					imgPoint07: [],
					imgPoint08: [],
					imgPoint09: [],
					imgPoint10: [],
					imgPoint11: [],
					imgPoint12: [],
					imgPoint13: [],
				},
				options: [{
					value: '未完成巡检',
					label: '未完成巡检'
				}, {
					value: '已完成巡检',
					label: '已完成巡检'
				}],
				value: '',
				loading: false,
				list: [],
				total: 0, // 一共多少条数据
				timeModel: [],
				visible: false,
				detailModel: false,
				rules: {
					productName: [{
						required: true,
						message: "请您输入业主档案名称",
						trigger: "blur"
					}],
				},
				fileHeaders: fileUpdata.headers(),
				fileUrl: "/special/dictionary/files/upload/",
				fileList: [],
				deleteName: [],
				imgPoint01: [],
				imgPoint02: [],
				imgPoint03: [],
				imgPoint04: [],
				imgPoint05: [],
				imgPoint06: [],
				imgPoint07: [],
				imgPoint08: [],
				imgPoint09: [],
				imgPoint10: [],
				imgPoint11: [],
				imgPoint12: [],
				imgPoint13: [],
			};
		},
		// 初始化
		mounted() {
			this.getList();
		},
		// 函数集合
		methods: {
			// 下载文件
			downLoadProjectFile(row) {
				this.getBlob(row.filePath, (blob) => {
					this.saveAs(blob, row.fileName)
				})
			},
			getBlob(url, cb) {
				var xhr = new XMLHttpRequest;
				xhr.open('GET', url, true);
				xhr.responseType = 'blob';
				xhr.onload = function() {
					if (xhr.status == 200) {
						cb(xhr.response)
					}
				}
				xhr.send();
			},
			saveAs(blob, fileName) {
				if (window.navigator.msSaveOrOpenBlob) {
					navigator.msSaveBlob(blob, fileName)
				} else {
					const link = document.createElement('a')
					const body = document.querySelector('body')
					link.href = window.URL.createObjectURL(blob)
					link.download = fileName
					link.style.display = 'none'
					body.appendChild(link)
					link.click()
					body.removeChild(link)
					window.URL.revokeObjectURL(link.href)
				}
			},
			// 删除文件
			deleteProjectFile(row) {
				var that = this;
				that.$message.success("文档操作成功")
			},
			handleAvatarError(res, file) {
				this.$message.error("文件上传失败，请重试")
			},
			// 修改巡查档案
			editProduct(row) {
				var type = "";
				console.log('row',row)
				this.deleteName = []
				if (row.id) {
					// 修改
					type = "edit";
					this.dataForm = row;
					console.log(this.dataForm.imgPoint01)
					if (this.dataForm.imgPoint01 != undefined) {
						this.dataForm.imgPoint01 = JSON.parse(this.dataForm.imgPoint01);
						this.dataForm.imgPoint01.forEach(item => {
							item.url = 'https://www.ansteelproperty.com' + item.url;
						});
					}
					if (this.dataForm.imgPoint02 != undefined) {
						this.dataForm.imgPoint02 = JSON.parse(this.dataForm.imgPoint02);
						this.dataForm.imgPoint02.forEach(item => {
							item.url = 'https://www.ansteelproperty.com' + item.url;
						});
					}
					if (this.dataForm.imgPoint03 != undefined) {
						this.dataForm.imgPoint03 = JSON.parse(this.dataForm.imgPoint03);
						this.dataForm.imgPoint03.forEach(item => {
							item.url = 'https://www.ansteelproperty.com' + item.url;
						});
					}
					if (this.dataForm.imgPoint04 != undefined) {
						this.dataForm.imgPoint04 = JSON.parse(this.dataForm.imgPoint04);
						this.dataForm.imgPoint04.forEach(item => {
							item.url = 'https://www.ansteelproperty.com' + item.url;
						});
					}
					if (this.dataForm.imgPoint05 != undefined) {
						this.dataForm.imgPoint05 = JSON.parse(this.dataForm.imgPoint05);
						this.dataForm.imgPoint05.forEach(item => {
							item.url = 'https://www.ansteelproperty.com' + item.url;
						});
					}
					if (this.dataForm.imgPoint06 != undefined) {
						this.dataForm.imgPoint06 = JSON.parse(this.dataForm.imgPoint06);
						this.dataForm.imgPoint06.forEach(item => {
							item.url = 'https://www.ansteelproperty.com' + item.url;
						});
					}
					if (this.dataForm.imgPoint07 != undefined) {
						this.dataForm.imgPoint07 = JSON.parse(this.dataForm.imgPoint07);
						this.dataForm.imgPoint07.forEach(item => {
							item.url = 'https://www.ansteelproperty.com' + item.url;
						});
					}
					if (this.dataForm.imgPoint08 != undefined) {
						this.dataForm.imgPoint08 = JSON.parse(this.dataForm.imgPoint08);
						this.dataForm.imgPoint08.forEach(item => {
							item.url = 'https://www.ansteelproperty.com' + item.url;
						});
					}
					if (this.dataForm.imgPoint09 != undefined) {
						this.dataForm.imgPoint09 = JSON.parse(this.dataForm.imgPoint09);
						this.dataForm.imgPoint09.forEach(item => {
							item.url = 'https://www.ansteelproperty.com' + item.url;
						});
					}
					if (this.dataForm.imgPoint10 != undefined) {
						this.dataForm.imgPoint10 = JSON.parse(this.dataForm.imgPoint10);
						this.dataForm.imgPoint10.forEach(item => {
							item.url = 'https://www.ansteelproperty.com' + item.url;
						});
					}
					if (this.dataForm.imgPoint11 != undefined) {
						this.dataForm.imgPoint11 = JSON.parse(this.dataForm.imgPoint11);
						this.dataForm.imgPoint11.forEach(item => {
							item.url = 'https://www.ansteelproperty.com' + item.url;
						});
					}
					if (this.dataForm.imgPoint12 != undefined) {
						this.dataForm.imgPoint12 = JSON.parse(this.dataForm.imgPoint12);
						this.dataForm.imgPoint12.forEach(item => {
							item.url = 'https://www.ansteelproperty.com' + item.url;
						});
					}
					if (this.dataForm.imgPoint13 != undefined) {
						this.dataForm.imgPoint13 = JSON.parse(this.dataForm.imgPoint13);
						this.dataForm.imgPoint13.forEach(item => {
							item.url = 'https://www.ansteelproperty.com' + item.url;
						});
					}
				} else {
					// 新增
					type = "add";
					this.dataForm = {};
				}
				this.visible = true;
			},
			// 查看业主档案详情
			lookProduct(row) {
				this.dataForm = row;
				this.detailModel = true;
			},
			// 删除业主档案
			delProduct(row) {
				this.$confirm("是否删除？", "提示", {
						confirmButtonText: "确 认",
						cancelButtonText: "取 消"
					})
					.then(() => {
						deleteFlowInspectionGuard({
							...row
						}).then(res => {
							if (res.code == 200) {
								this.$message({
									message: res.msg,
									type: 'success',
									duration: 1000,
									onClose: () => {
										this.visible = false;
										this.getList();
									},
								});
							}
						})
					})
					.catch(() => console.info("操作取消"));
			},
			//提交业主档案
			submitProduct() {
				var that = this;
				var number = "";
				// for (var i = 0; i < that.buildings.length; i++) {
				// 	if (that.buildings[i].id == that.dataForm.block) {
				// 		that.dataForm.building = that.buildings[i].number;
				// 	}
				// }
				let getId = this.deleteName.map(item => item.name)
				console.log('getId',getId)
				if(getId != []){
					this.dataForm.imgPoint01 = this.imgPoint01.filter(item => !getId.includes(item.name))
					this.dataForm.imgPoint02 = this.imgPoint02.filter(item => !getId.includes(item.name))
					this.dataForm.imgPoint03 = this.imgPoint03.filter(item => !getId.includes(item.name))
					this.dataForm.imgPoint04 = this.imgPoint04.filter(item => !getId.includes(item.name))
					this.dataForm.imgPoint05 = this.imgPoint05.filter(item => !getId.includes(item.name))
					this.dataForm.imgPoint06 = this.imgPoint06.filter(item => !getId.includes(item.name))
					this.dataForm.imgPoint07 = this.imgPoint07.filter(item => !getId.includes(item.name))
					this.dataForm.imgPoint08 = this.imgPoint08.filter(item => !getId.includes(item.name))
					this.dataForm.imgPoint09 = this.imgPoint09.filter(item => !getId.includes(item.name))
					this.dataForm.imgPoint10 = this.imgPoint10.filter(item => !getId.includes(item.name))
					this.dataForm.imgPoint11 = this.imgPoint11.filter(item => !getId.includes(item.name))
					this.dataForm.imgPoint12 = this.imgPoint12.filter(item => !getId.includes(item.name))
					this.dataForm.imgPoint13 = this.imgPoint13.filter(item => !getId.includes(item.name))
				} else {
					this.dataForm.imgPoint01 = this.imgPoint01
					this.dataForm.imgPoint02 = this.imgPoint02
					this.dataForm.imgPoint03 = this.imgPoint03
					this.dataForm.imgPoint04 = this.imgPoint04
					this.dataForm.imgPoint05 = this.imgPoint05
					this.dataForm.imgPoint06 = this.imgPoint06
					this.dataForm.imgPoint07 = this.imgPoint07
					this.dataForm.imgPoint08 = this.imgPoint08
					this.dataForm.imgPoint09 = this.imgPoint09
					this.dataForm.imgPoint10 = this.imgPoint10
					this.dataForm.imgPoint11 = this.imgPoint11
					this.dataForm.imgPoint12 = this.imgPoint12
					this.dataForm.imgPoint13 = this.imgPoint13
				}
				this.$refs['form'].validate(valid => {
					if (valid) {
						if (this.dataForm.id) {
							editFlowInspectionGuard({
								...this.dataForm
							}).then(res => {
								if (res.code == 200) {
									this.$message({
										message: res.msg,
										type: 'success',
										duration: 1000,
										onClose: () => {
											this.visible = false;
											this.getList();
										},
									});
								}
							})
						} else {
							insertFlowInspectionGuard({
								...this.dataForm
							}).then(res => {
								if (res.code == 200) {
									this.$message({
										message: res.msg,
										type: 'success',
										duration: 1000,
										onClose: () => {
											this.visible = false;
											this.getList();
										},
									});
								}
							})
						}
					}
				})
			},
			//初始化列表
			getList() {
				this.loading = false;
				flowInspectionGuard({
					...this.queryParams
				}).then(res => {
					this.list = res.rows;
					this.total = res.total
				})
			},
			// 上传成功
			handleAvatarSuccess(res, e, x, name) {
				console.log('2222', res)
				console.log('e', e)
				if (res.code == 200) {
					let nameList = []
					var picUrl = res.msg;
					console.log('picUrl',picUrl)
					if(name == 'desPoint01'){
						nameList.push(picUrl)
						this.dataForm.imgPoint01 = nameList
						console.log('nameList',this.imgPoint01)
					} else if(name == 'desPoint02') {
						nameList.push(picUrl)
						this.dataForm.imgPoint02 = nameList
					} else if(name == 'desPoint03') {
						nameList.push(picUrl)
						this.dataForm.imgPoint03 = nameList
					} else if(name == 'desPoint04') {
						nameList.push(picUrl)
						this.dataForm.imgPoint04 = nameList
					} else if(name == 'desPoint05') {
						nameList.push(picUrl)
						this.dataForm.imgPoint05 = nameList
					} else if(name == 'desPoint06') {
						nameList.push(picUrl)
						this.dataForm.imgPoint06 = nameList
					} else if(name == 'desPoint07') {
						nameList.push(picUrl)
						this.dataForm.imgPoint07 = nameList
					} else if(name == 'desPoint08') {
						nameList.push(picUrl)
						this.dataForm.imgPoint08 = nameList
					} else if(name == 'desPoint09') {
						nameList.push(picUrl)
						this.dataForm.imgPoint09 = nameList
					} else if(name == 'desPoint10') {
						nameList.push(picUrl)
						this.dataForm.imgPoint10 = nameList
					} else if(name == 'desPoint11') {
						nameList.push(picUrl)
						this.dataForm.imgPoint11 = nameList
					} else if(name == 'desPoint12') {
						nameList.push(picUrl)
						this.dataForm.imgPoint12 = nameList
					} else {
						nameList.push(picUrl)
						this.dataForm.imgPoint13 = nameList
					}
					let obj = {
						url: picUrl,
						name: e.name
					}
					if(name == 'desPoint01'){
						this.imgPoint01.push(obj)
					} else if(name == 'desPoint02') {
						this.imgPoint02.push(obj)
					} else if(name == 'desPoint03') {
						this.imgPoint03.push(obj)
					} else if(name == 'desPoint04') {
						this.imgPoint04.push(obj)
					} else if(name == 'desPoint05') {
						this.imgPoint05.push(obj)
					} else if(name == 'desPoint06') {
						this.imgPoint06.push(obj)
					} else if(name == 'desPoint07') {
						this.imgPoint07.push(obj)
					} else if(name == 'desPoint08') {
						this.imgPoint08.push(obj)
					} else if(name == 'desPoint09') {
						this.imgPoint09.push(obj)
					} else if(name == 'desPoint10') {
						this.imgPoint10.push(obj)
					} else if(name == 'desPoint11') {
						this.imgPoint11.push(obj)
					} else if(name == 'desPoint12') {
						this.imgPoint12.push(obj)
					} else {
						this.imgPoint13.push(obj)
					}
				}
			},
			// 删除图片
			handleRemove(file) {
				let obj = {
					name: file.name
				}
				this.deleteName.push(obj)
				console.log(this.deleteName)
			},
			onChange(file, fileList) {
				console.log('111', fileList);
			},
			handlePreview(file) {
				console.log(file);
			},
			handleExceed(files, fileList) {
				this.$message.warning(`当前限制选择 10个文件，本次选择了 ${files.length} 个文件，共选择了 ${files.length + fileList.length} 个文件`);
			},
			beforeRemove(file, fileList) {
				return this.$confirm(`确定移除 ${ file.name }？`);
			},
			reset() {
				this.queryParams = {
					pageNum: 1,
					pageSize: 10
				}
			},

		}
	}
</script>
<style scoped lang='scss'>
	.editBtn span {
		color: red;
	}

	.deleteBtn span {
		color: red;
	}

	.detailBtn span {
		color: red;
	}

	.el-date-editor.el-input,
	.el-date-editor.el-input__inner {
		width: 100%;
	}

	.detailForm {
		.el-form-item {
			margin-bottom: 0px;
		}
	}
</style>